From: Carlos Garnacho Date: Thu, 28 May 2020 12:03:13 +0000 (+0200) Subject: padOsd: Move button/ring/strip label creation to PadDiagram X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~340 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c90e7ce25814f6dcd0e52c00961fe936649811b0;p=gnome-shell.git padOsd: Move button/ring/strip label creation to PadDiagram It's the natural container of those. We can create all those labels internally, and only expose the updateLabels() method to update them wholesome. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1290 --- diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js index 221c8ddd6..d874f000e 100644 --- a/js/ui/padOsd.js +++ b/js/ui/padOsd.js @@ -329,6 +329,7 @@ var PadDiagram = GObject.registerClass({ this._imagePath = imagePath; this._handle = this._composeStyledDiagram(); + this._initLabels(); } // eslint-disable-next-line camelcase @@ -343,6 +344,33 @@ var PadDiagram = GObject.registerClass({ this.add_actor(actor); } + _initLabels() { + // FIXME: Fix num buttons. + let i = 0; + for (i = 0; i < 50; i++) { + let [found] = this.getButtonLabelCoords(i); + if (!found) + break; + this._addLabel(Meta.PadActionType.BUTTON, i); + } + + for (i = 0; i < 2; i++) { + let [found] = this.getRingLabelCoords(i, CW); + if (!found) + break; + this._addLabel(Meta.PadActionType.RING, i, CW); + this._addLabel(Meta.PadActionType.RING, i, CCW); + } + + for (i = 0; i < 2; i++) { + let [found] = this.getStripLabelCoords(i, UP); + if (!found) + break; + this._addLabel(Meta.PadActionType.STRIP, i, UP); + this._addLabel(Meta.PadActionType.STRIP, i, DOWN); + } + } + _wrappingSvgHeader() { return '' + '